package com.feixiu.service.impl;

import com.feixiu.dao.StaffDao;
import com.feixiu.pojo.Staff;
import com.feixiu.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StaffServiceImpl implements StaffService {
    @Autowired
    private StaffDao staffDao;
    @Override
    public Boolean login(String account, String password) {
        Staff staff=staffDao.selectById(account);
        if (staff==null){
            return false;
        }else if (staff.getStaffpwd().equals(password)){
            return true;
        }
        return false;
    }

    @Override
    public Boolean isStuff(String account) {
        Staff staff=staffDao.selectById(account);
        if (staff.getStationno()==1101){
            return true;
        }
        return false;
    }

    @Override
    public Staff getStuffById(String account) {
        Staff staff=staffDao.selectById(account);
        staff.setStaffpwd("");
        if (staff.getDetail()==null){
            staff.setDetail("没有详细信息");
        }else if (staff.getPhone()==null){
            staff.setPhone("没有手机号");
        }
        return staff;
    }
}
